package com.igoal.dao;

import java.util.Date;
import java.util.List;

import org.hibernate.criterion.MatchMode;

import com.igoal.entity.DataStatus;
import com.igoal.entity.Goal;

/**
 * DAO for {@link Goal} entity
 * @author Tri
 * @since 6/19/2010
 */
public interface GoalDAO extends GenericDao<Goal, Long> {
	/**
	 * Check and make sure the goal title is unique
	 * @param title
	 * @return
	 */
	boolean exists(String title);
	
	/**
	 * Find goal by title of goal and status is {@link DataStatus} is USING
	 * @param title
	 * @return
	 */
	Goal findByTitle(String title);
	
	List<Goal> findByTitle(String title, MatchMode matchMode, int numberOfGoals);
	
	/**
	 * Sort by userCount
	 * @return list of {@link Goal} 
	 */
	List<Goal> findTopGoals(int numberOfGoals);
	
	List<Goal> getShouldDoGoals(int numberOfGoals, long userId);
	
	int countGoalsFrom(Date date);
	
	List<Goal> getRandomGoals(int maxGoals);
}
